package com.ktjiaoyu.crm.controller;

import com.ktjiaoyu.crm.pojo.User;
import com.ktjiaoyu.crm.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
public class UserController {

    @Autowired
    private UserService userService;

    @GetMapping(value = "/sys/users")
    public List<User> getUsers(){
        List<User> userList = userService.findAllUsers();
        return userList;
    }

    @GetMapping(value = "/user/{id}")
    public User getUser(@PathVariable("id")Long usrId){
        User user = userService.getUser(usrId);
        return user;
    }

    /*@RequestMapping(value = "/user",method = RequestMethod.GET)
    public User getUser(Long usrId){
        User user = userService.getUser(usrId);
        return user;
    }*/

}
